from pydantic import BaseModel, Field
from typing import Optional
from datetime import datetime

class SpiderBase(BaseModel):
    name: str = Field(..., description="爬虫名称")
    description: Optional[str] = Field(None, description="爬虫描述")

class SpiderCreate(SpiderBase):
    pass

class SpiderUpdate(BaseModel):
    name: Optional[str] = Field(None, description="爬虫名称")
    description: Optional[str] = Field(None, description="爬虫描述")

class SpiderRead(SpiderBase):
    id: str = Field(..., description="爬虫唯一标识符")
    created_at: datetime = Field(..., description="创建时间")
    updated_at: datetime = Field(..., description="最后更新时间")
    
    class Config:
        orm_mode = True